<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core"  prefix="c"%>
<!DOCTYPE HTML>
<html>
<head>
    <%@include file="/WEB-INF/pages/header.jsp" %>
    <title>修改基本信息</title>
</head>
<body>
<div class="pd-20">

    <script type="text/javascript">
        $(function(){
            $("form").validate({
                'rules':{

                },
                messages:{

                },
                submitHandler:function(form){
                    var bool = window.confirm("确定要进行此操作吗？");

                    //如果用户点了确认按钮
                    if(bool)
                    {
                        $.post(form.action, $(form).serialize(), function(ajaxResult) {
                            alert(ajaxResult.msg);

                            if(ajaxResult.code==200)
                            {
                                parent.location.reload();
                            }
                            else
                            {
                                location.reload();
                                //刷新本页面
                            }
                        }, 'json');
                        event.preventDefault();
                    }
                }
            });
        });

    </script>

    <!-- 修改基本信息 -->
    <form action="<%=ctxPath %>/author/updateInfo"  method="post" class="form form-horizontal">

        <input type="hidden" name="id" value="${author.id }" />

        <div class="row cl">
            <label class="form-label col-2">作者姓名</label>
            <div class="formControls col-5">${author.userName }</div>
            <div class="col-5"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-2">昵称</label>
            <div class="formControls col-5">
                <input type="text" class="input-text" value="${author.nickName}" name="nickName" />
            </div>
            <div class="col-5"></div>
        </div>

        <div class="row cl">
            <div class="col-9 col-offset-2">
                <input class="btn btn-primary radius" type="submit" value="修改" />
                <input class="btn btn-default radius" type="button" value="关闭" onclick="parent.location.reload()" style="margin-left: 30px;" />
            </div>
        </div>
    </form>
</div>
</body>
</html>